import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

class Dog{
    public String nsme;
    public int age;

    public Dog(String nsme, int age) {
        this.nsme = nsme;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "nsme='" + nsme + '\'' +
                ", age=" + age +
                '}';
    }
}
public class Main {
    public static void main(String[] args) {
        List collection=new ArrayList<>();
        collection.add(new Dog("xx",12));
        collection.add(new Dog("xxx",13));
        collection.add(new Dog("xxxx",14));
        for (Object o :collection) {
            System.out.println(o);
        }


    }
}